package com.craft.part2.common;

public class ASTUtil {

    /**
     * 打印输出AST的树状结构
     * @param node
     * @param indent 缩进字符，由tab组成，每一级多一个tab
     */
    public static void dumpAST(ASTNode node, String indent){
        System.out.println(indent + node.getType() + " " + node.getText());
        for(ASTNode child : node.getChildren()){
            dumpAST(child, indent + "\t");
        }
    }
}
